#include "ExplosionColumn.h"
#include "OgreStringConverter.h"
#include "OgreMath.h"

ExplosionColumn::ExplosionColumn(Ogre::SceneManager * sceneManager):AnimationEvent() {
	systemNameExplosion = 0;
	_mScene = sceneManager;
	_started = false;

}

ExplosionColumn::~ExplosionColumn(void) {}

void ExplosionColumn::prepareEvent() {
	_explosionParticleSystem = _mScene->createParticleSystem("Explosion" + Ogre::StringConverter::toString(systemNameExplosion), "Explosion_column");
	systemNameExplosion++;
	_explosionNode = _mScene->createSceneNode();
	_explosionNode->translate(0,550,0,Ogre::Node::TS_PARENT);
	_explosionNode->attachObject(_explosionParticleSystem);

	_explosionParticleSystem->setRenderQueueGroup(Ogre::RENDER_QUEUE_6);
}

void ExplosionColumn::startEvent() {
	_mScene->getRootSceneNode()->createChildSceneNode()->addChild(_explosionNode);
	_started = true;

}

void ExplosionColumn::restartEvent() {
	this->prepareEvent();
	this->startEvent();

}

bool ExplosionColumn::hasStarted() {
	return _started;
}

void ExplosionColumn::update(float deltaTime) {

}

void ExplosionColumn::quit() {
	_explosionParticleSystem->removeAllEmitters();
	//_explosionNode->detachAllObjects();
	_started = false;
}
